<?php

namespace App\Admin\Controllers;

use Encore\Admin\Layout\Content;
use Carbon\Carbon;
use App\Models\GcCategory;
use App\Models\SeckillProduct;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Controllers\AdminController;
use App\Admin\Actions\CollectionAction\CollectionImages;
use App\Admin\Actions\CollectionAction\Materials;
use App\Admin\Actions\CollectionAction\BatchImgCreate;
use App\Admin\Tools\BatchCreateCombination;
use ZipArchive;
use Illuminate\Support\Facades\File;
use Intervention\Image\Facades\Image;
use Illuminate\Support\Facades\Storage;


class GcCategoriesController extends AdminController
{
    protected $title = '分类列表';
    
    protected function grid()
    {
        $grid = new Grid(new GcCategory());
	
	    $grid->disableExport();
	    
	    $grid->column('id', 'ID');
        $grid->column('name', '名称');
        $this->gridActions($grid);
         $this->gridTools($grid);
       
        return $grid;
    }
    
     protected function gridTools(Grid $grid)
    {
        $grid->tools(function (Grid\Tools $tools) {
           // $tools->append(new BatchCreateCombination());
        });
    }

    protected function gridActions(Grid $grid)
    {
        $grid->actions(function (Grid\Displayers\Actions $actions) {
            $actions->disableView();
           /* $actions->add(new CollectionImages());
            $actions->add(new Materials());
            $actions->add(new BatchImgCreate());*/
        });
    }


    protected function detail($id)
    {
        $show = new Show(GcCategory::findOrFail($id));

        return $show;
    }

    
    protected function form()
    {
        $form = new Form(new GcCategory());
        $form->text('name', '名称');
       // $this->formSaved($form);

        return $form;
    }

  
}
